
import {reqcatSearchInfo} from '@/api/index'

//准备actions一用于响应组件中的动作
const actions ={
    async getSearchList({commit},params={}){
        let result = await reqcatSearchInfo(params)
        if(result.code == 200){
            commit('GETSEARCHLIST',result.data)
        }
    }
}
//准备mutations.一用于操作数据(state)
const mutations ={
    GETSEARCHLIST(state,getSearchList){
        state.getSearchList = getSearchList
    }
}
//准备state一用于存储数据
const state ={
    getSearchList:{},
}
//getters:理解为计算属性，用于简化仓库数据，让组件获取仓库的数据更加方便
const getters = {
    trademarkList(){
        return state.getSearchList.trademarkList
    },
    attrsList(){
        return state.getSearchList.attrsList
    },
    goodsList(){
        return state.getSearchList.goodsList
    },
}

//创建并暴露store
export default{
state,
mutations,
actions,
getters,
}